package edu.jmu.dustbinMonitoringSystem.controller;

import edu.jmu.dustbinMonitoringSystem.domain.TrashData;
import edu.jmu.dustbinMonitoringSystem.dto.AbstractBaseResult;
import edu.jmu.dustbinMonitoringSystem.service.TrashDataService;
import edu.jmu.dustbinMonitoringSystem.web.AbstractBaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;

/**
 * @author Wen
 */
@RestController
@RequestMapping(value = "data")
public class TrashDataController extends AbstractBaseController<TrashData> {

    @Autowired
    private TrashDataService trashDataService;

    @GetMapping(value = "getAll")
    public AbstractBaseResult getAllListData() {
        TrashData data = new TrashData();
        List<TrashData> list = trashDataService.all(data);
        return success(0, 0, list);
    }

    @PostMapping(value = "save")
    public void saveData(TrashData data) {
        trashDataService.save(data);
    }

}
